home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr48 / pas_0593.zip / MAKENEWS.PAS < prev    next >
Pascal/Delphi Source File  |  1993-05-30  |  3KB  |  73 lines

  1. {─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
  2. Msg  : 209 of 773
  3. From : Chad Thevis                         1:3811/210.0         03 May 93  17:59
  4. To   : Ron Phillips
  5. Subj : ANSI
  6. ────────────────────────────────────────────────────────────────────────────────
  7. RP>   I have TheDraw! Your not understanding what I want to do. I want to make
  8. RP> news file like "DGBG" "NewsFlash" and "NewsFile" like them. You write your
  9. RP> news in a txt file editor then run it with the newsfile and it makes your
  10. RP> ansi and ascii screen. I can't get any more specific than this.
  11.  
  12. Here is a very simple example of how to do this.  Hope it helps some.
  13. I threw it together in about 15 minutes but it does run.}
  14.  
  15. Program MakeNews;
  16. Var
  17.    x,cnt : integer;
  18.    s:char;
  19.    ans,asc:text;
  20.    date : string;
  21.    news : array[1..50] of string;
  22. Begin
  23.    assign(ans,'news.ans');
  24.    rewrite(ans);
  25.    assign(asc,'news.asc');
  26.    rewrite(asc);
  27.    s:=chr(27);         { This is the  char }
  28.    write('What is the date > ');
  29.    readln(date);
  30.    write(ans,s,'[0m');      { This clears all ansi attributes }
  31.    write(ans,s,'[34;47m');  { This Makes output Blue with While Lettering}
  32.    
  33. writeln(ans,'╔══════════════════════════════════════════════════════════════════╗',s,'[0m');
  34.    write(ans,s,'[34;47m');
  35.    writeln(ans,'║   The News on My BBS                                             ║',s,'[0m');
  36.    write(ans,s,'[34;47m');
  37.  
  38. writeln(ans,'╚══════════════════════════════════════════════════════════════════╝',s,'[0m');
  39.  
  40. writeln(asc,'╔══════════════════════════════════════════════════════════════════╗');
  41. writeln(asc,'║   The News on My BBS                                             ║');
  42.  
  43.   writeln(asc,'╚══════════════════════════════════════════════════════════════════╝');
  44.    writeln(ans);
  45.    writeln(asc);
  46.    cnt := 0;
  47.    Repeat                      {This lets you enter the text}
  48.         cnt:=cnt+1;            {I didn't test for the array size, but}
  49.         readln(news[cnt]);     {50 lines should be enough.  You could read}
  50.    until news[cnt] = 'XXX';    {this from a file and do it that way}
  51.    writeln(ans,s,'[33;1;5m',date,s,'[0m');   {It'll accept input until you}
  52.    writeln(ans);                             {enter XXX, but I hope you 
  53. guessed that}
  54.    writeln(asc,date);
  55.    writeln(asc);
  56.    for x:= 1 to cnt-1 do
  57.         begin
  58.         writeln(ans,s,'[34;1m',news[x]);   {And this writes is out to the 
  59. file}
  60.         writeln(asc,news[x]);
  61.         end;
  62.    writeln(ans,s,'[0m');                   {This clears all ansi codes}
  63.    close(ans);
  64.    close(asc);
  65. end.
  66.  
  67. I noticed that it strippd the backwards arrow CHR(27) from the
  68. comment.  But anyway, that's what it is.  You might also want to
  69. put a CHR(27)[2J at the beginning of the ANS file to cause it to
  70. clear the screen when it's displayed.  And also at the end you could
  71. put the CHR(1), the smiley face to make it wait for <ENTER> to continue.
  72. It'll work in the BBS, not when you just type the file.  You can find
  73. these codes in the DOS book under ANSI.SYS - Ansi escape sequences.